#!/bin/bash
#===-- tools/f18/flang.sh -----------------------------------------*- sh -*-===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#

wd=$(cd $(dirname "$0")/.. && pwd)
module_dir=$wd/include/flang
if [[ ! -d $module_dir ]]; then
  module_dir=$wd/tools/flang/include/flang
fi
opts="-module-suffix .f18.mod -intrinsic-module-directory $module_dir"
if ! $wd/bin/f18 $opts "$@"
then status=$?
     echo flang: in $PWD, f18 failed with exit status $status: $wd/bin/f18 $opts "$@" >&2
     exit $status
fi
